package com.cloud.tsp.controller;

import com.cloud.api.constants.StrVo;
import com.cloud.api.domain.job.QueryService;
import com.cloud.api.domain.job.ServiceStation;
import com.cloud.api.domain.stats.QueryMaintenance;
import com.cloud.core.util.R;
import com.cloud.log.annotation.Log;
import com.cloud.log.enums.BusinessType;
import com.cloud.log.enums.OperatorType;
import com.cloud.mybatis.domain.TableDataInfo;
import com.cloud.tsp.service.IServiceStationService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author haohaibo
 * @since 2025-01-15
 */
@Tag(name = "服务站模块")
@ApiSupport(order = 202)
@RestController
@RequestMapping("/service-station")
public class ServiceStationController {

    @Resource
    private IServiceStationService serviceStationService;

    @Tag(name = "v1.0")
    @Operation(summary = "查询维修站列表（管理）")
    @PostMapping("/getServiceStationList")
    @Log(title = "维修站信息-查询维修站列表", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public TableDataInfo<ServiceStation> selectServiceStationList(@RequestBody @Valid QueryService para){
        return serviceStationService.selectServiceStationList(para);
    }

    @Tag(name = "v1.0")
    @Operation(summary = "新增或修改维修站（管理）")
    @PostMapping("/InsertOrUpdateServiceStation")
    @Log(title = "维修站信息-新增或修改维修站", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R InsertOrUpdateServiceStation(@RequestBody @Valid ServiceStation para){
        serviceStationService.InsertOrUpdateServiceStation(para);
        return R.ok();
    }

    @Tag(name = "v1.0")
    @Operation(summary = "查询维修站详情（管理）")
    @PostMapping("/getServiceStationDetail")
    @Log(title = "维修站信息-查询维修站详情", businessType = BusinessType.OTHER, operatorType = OperatorType.MANAGE)
    public R<ServiceStation> selectServiceStationDetail(@RequestBody @Valid StrVo para){
        return R.ok(serviceStationService.getById(para.getId()));
    }


}